<?php
	chong_pha_hoai();
	echo "Trang cập nhật sản phẩm";
?>
<form action="" method="post">
<center>
	<table width="1000px" border="1">
	  <tr>
		<td>
			<?php
				$id_sanpham=$_GET['id'];
				$tv="select * from sanpham where id_sanpham='$id_sanpham'";
				$tv_1=mysql_query($tv);
				$tv_2=mysql_fetch_array($tv_1);
			?>
				<center><h2>SỬA SẢN PHẨM</h2></center>
				<table width="100%" border="1">
				  <tr>
					<td width="300px" valign="top">
						<?php
							$link_hinh="../images/sanpham/".$tv_2['hinh'];
							echo "<img border=0 src='$link_hinh' height='400' width='300'/>";
						?>
					</td>
					<td>
						<table width="100%">
						  <tr>
							<td width="150px">id sản phẩm</td>
							<td><input size="20px" disabled="disabled" value="<?php echo $id_sanpham; ?>" /></td>
						  </tr>
						  <tr>
							<td>Loại sản phẩm</td>
							<?php
								$a="select * from loaisp where id_loaisp='$tv_2[id_loaisp]'";
								$a_1=mysql_query($a);
								$a_2=mysql_fetch_array($a_1);
								echo"<td>";
									echo"<input size='20px' disabled='disabled' value='$a_2[ten_loaisp]' />";
								echo "</td>";
							?>
						  </tr>
						  <tr>
							<td>Tên sản phẩm:</td>
							<td><input size="20px" name="ten_sanpham" value="<?php echo $tv_2['ten_sanpham']; ?>" /></td>
						  </tr>
						  <tr>
							<td>Đơn giá:</td>
							<td><input size="20px" name="dongia_sanpham" value="<?php echo $tv_2['dongia_sanpham']; ?>" /></td>
						  </tr>
						  <tr>
							<td>Mô tả sản phẩm:</td>
							<td>
							<?php
								$a="select * from sanpham where id_loaisp='$tv_2[id_loaisp]'";
								$a_1=mysql_query($a);
								$a_2=mysql_fetch_array($a_1);
							?>
							<script type="text/javascript">
								var oFCKeditor = new FCKeditor('noi_dung') ;
								oFCKeditor.BasePath	= "fckeditor/" ;
								oFCKeditor.Height	= 300 ;
								oFCKeditor.Width	= 550 ;
								oFCKeditor.Value	= '<?php echo $a_2['mota_sanpham'];?>';
								oFCKeditor.Config ["EnterMode"] = "br" ;
								oFCKeditor.Create() ;
							</script>
							</td>
						  </tr>
						  <tr>
							<td><b>Trạng thái:</b></td>
							<td>
								<input name="isActive" type="radio" value="1" 
									<?php 
										if($tv_2['isActive']==1)
										{
											echo "checked='checked'";
										} 
									?>
								>Hiển thị
								<br />
								<input name="isActive" type="radio" value="0" 
									<?php 
										if($tv_2['isActive']!=1)
										{
											echo "checked='checked'";
										} 
									?>
								>Không hiển thị
							</td>
						  </tr>
						  <tr>
							<td>&nbsp;</td>
							<td>
								<input type="hidden" name="update_sanpham" value="update_sanpham">
								<input type="submit" value="Cập nhật">
							</td>
						  </tr>
						</table>
					</td>
				  </tr>
				</table>


		</td>
	  </tr>
	</table>
</center>
</form>